const toGetString = Object.prototype.toString;

export function is(val: unknown, type: string) {
  return toGetString.call(val) === `[object ${type}]`;
}

export function isFunction<T = Function>(val: unknown): val is T {
  return is(val, "Function");
}

export function isString<T = string>(val: unknown): val is T {
  return is(val, "String");
}
